package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.PropertyBasicsInfo;
import com.ruoyi.system.domain.vo.WarehousingInfo;
import com.ruoyi.system.service.IPropertyBasicsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;

/**
 * 资产信息基础管理Controller
 * 
 * @author ruoyi
 * @date 2023-02-08
 */
@RestController
@RequestMapping("/system/info")
public class PropertyBasicsInfoController extends BaseController
{
    @Autowired
    private IPropertyBasicsInfoService propertyBasicsInfoService;

    /**
     * 查询资产信息基础管理列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PropertyBasicsInfo propertyBasicsInfo)
    {
        startPage();
        List<PropertyBasicsInfo> list = propertyBasicsInfoService.selectPropertyBasicsInfoList(propertyBasicsInfo);
        return getDataTable(list);
    }

    /**
     * 导出资产信息基础管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:export')")
    @Log(title = "资产信息基础管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PropertyBasicsInfo propertyBasicsInfo)
    {
        List<PropertyBasicsInfo> list = propertyBasicsInfoService.selectPropertyBasicsInfoList(propertyBasicsInfo);
        ExcelUtil<PropertyBasicsInfo> util = new ExcelUtil<PropertyBasicsInfo>(PropertyBasicsInfo.class);
        util.exportExcel(response, list, "资产信息基础管理数据");
    }

    /**
     * 获取资产信息基础管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(propertyBasicsInfoService.selectPropertyBasicsInfoById(id));
    }

    /**
     * 新增资产信息基础管理
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "资产信息基础管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PropertyBasicsInfo propertyBasicsInfo)
    {
        return toAjax(propertyBasicsInfoService.insertPropertyBasicsInfo(propertyBasicsInfo));
    }

    /**
     * 修改资产信息基础管理
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "资产信息基础管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PropertyBasicsInfo propertyBasicsInfo)
    {
        return toAjax(propertyBasicsInfoService.updatePropertyBasicsInfo(propertyBasicsInfo));
    }

    /**
     * 删除资产信息基础管理
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "资产信息基础管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(propertyBasicsInfoService.deletePropertyBasicsInfoByIds(ids));
    }

    /**
     * 查询入库记录明细
     */
    @GetMapping("/warehousingInfoList")
    public TableDataInfo warehousingInfoList(WarehousingInfo warehousingInfo)
    {
        startPage();
        List<WarehousingInfo> list = propertyBasicsInfoService.warehousingInfoList(warehousingInfo);
        return getDataTable(list);
    }

    /**
     * 查询资产信息基础管理列表
     */
    @GetMapping("/toList")
    public  List<PropertyBasicsInfo> tolist(PropertyBasicsInfo propertyBasicsInfo)
    {
        List<PropertyBasicsInfo> list = propertyBasicsInfoService.selectPropertyBasicsInfoList(propertyBasicsInfo);
        return list;
    }
}
